import java.util.*;

/**
 * @Author 12629
 * @Description：
 */
public class Test {

    public static void main(String[] args) {
        char[] ch = new char[]{'a', 'b', 'c'};
        String s1 = new String(ch);
        s1.intern();
        String s2 = "abc";
        System.out.println(s1 == s2);
    }

    public static void main3(String[] args) {
        String s1 = "hello";
        String s2 = "hello";
        String s3 = new String("hello");
        System.out.println(s2 == s1);

    }

    public static void main2(String[] args) {
        HashMap<String,Integer> map = new HashMap<>(25);
        map.put("abc",1);
    }


    public int singleNumber(int[] array) {
        Set<Integer> set = new TreeSet<>();
        for(int i = 0;i < array.length;i++) {
            if(!set.contains(array[i])) {
                set.add(array[i]);
            }else {
                set.remove(array[i]);
            }
        }
        for(int i = 0;i < array.length;i++) {
            if(set.contains(array[i])) {
                return array[i];
            }
        }
        return -1;
    }

    /*public Node copyRandomList(Node head) {

        Map<Node,Node> map = new HashMap<>();

        //1. 第一次遍历链表
        Node cur = head;
        while(cur != null) {
            Node node = new Node(cur.val);
            map.put(cur,node);
            cur = cur.next;
        }
        //2. 第二次遍历链表
        cur = head;
        while(cur != null) {
            map.get(cur).next = map.get(cur.next);
            map.get(cur).random = map.get(cur.random);
            cur = cur.next;
        }
        return map.get(head);
    }*/

    public int numJewelsInStones(String jewels, String stones) {

        Set<Character> set = new HashSet<>();

        //1. 遍历宝石，把宝石放到集合
        for(int i = 0;i < jewels.length();i++) {
            char ch = jewels.charAt(i);
            set.add(ch);
        }

        int count = 0;
        //2.遍历石头
        for(int i = 0;i < stones.length();i++) {
            char ch = stones.charAt(i);
            if(set.contains(ch)) {
                count++;
            }
        }
        return count;
    }


    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str1 = in.nextLine();
            String str2 = in.nextLine();//实际输入的
            func(str1, str2);
        }
    }

    public static void func(String str1, String str2) {
        str1 = str1.toUpperCase();
        str2 = str2.toUpperCase();

        Set<Character> set = new HashSet<>();

        for(char ch : str2.toCharArray()) {
            set.add(ch);
        }

        //遍历第一个字符串 看哪个字符不在
        Set<Character> setBroken = new HashSet<>();
        for(char ch : str1.toCharArray()) {
            if(!set.contains(ch) && !setBroken.contains(ch)) {
                setBroken.add(ch);
                System.out.print(ch);
            }
        }
    }
}
